package org.springblade.modules.platform.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import org.springblade.modules.platform.dto.PhysicalDataTableDTO;
import org.springblade.modules.platform.dto.PhysicalDataTableListByPageDTO;
import org.springblade.modules.platform.service.IEngineerValueTableService;
import org.springblade.modules.platform.vo.EngineerValueTablePageVO;
import org.springblade.modules.platform.vo.EngineerValueTableVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;

@RestController
@AllArgsConstructor
@RequestMapping("/service-huateng-sxdb/engineerValue")
@Api(value = "", tags = "工程量")
@Slf4j
public class EngineerValueTableController {

    private final IEngineerValueTableService iEngineerValueTableService;


    @ApiLog("工程量")
    @GetMapping("/getListByPage")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "分页", notes = "传入physicalDataTableListByPageDTO")
    public R<EngineerValueTablePageVO> getListByPage(PhysicalDataTableListByPageDTO physicalDataTableListByPageDTO){
        return R.data(iEngineerValueTableService.getListByPage(physicalDataTableListByPageDTO));
    }
    @ApiLog("工程量")
    @GetMapping("/getOne")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "查询最新的工程量", notes = "deptId")
    public R<EngineerValueTableVO> getOne(Long deptId,Integer measurChainDirection ){
        return R.data(iEngineerValueTableService.getOneEngineerValue(deptId,measurChainDirection));

    }

	@ApiLog("设定初始值")
	@PostMapping("/basicsPhysical")
	@ApiOperationSupport(order = 4)
	@ApiOperation(value = "设定初始值", notes = "传入physicalDataTableListByPageDTO")
	public R getListByPage(@RequestBody PhysicalDataTableDTO physicalDataTableDTO){
		iEngineerValueTableService.selectEngineerValue( physicalDataTableDTO);
		return R.success("成功");
	}
}
